using System;
using System.Collections.Generic;
using System.Text;
using WindowsLive.Writer.Api;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace AcronymPlugin
{
    [WriterPlugin("3a2ddc1c-a380-4070-9592-4483af15c0d5", "Insert Acronym",
        Description = "A plugin that allows the user to add the abbr and acronym tags",
        HasEditableOptions = false,
        Name = "Acronym Tag Plugin",
        PublisherUrl = "http://scottisafooldev.spaces.live.com",
        ImagePath="icon.gif")]
    [InsertableContentSource("Acronym Tags")]

    public class clAcronym : ContentSource
    {
        // If you change the name after class, please change it here too
        public clAcronym()
        { }

        public override DialogResult CreateContent(IWin32Window dialogOwner, ref string newContent)
        {
            newContent = Regex.Replace(newContent, @"<(.|\n)*?>", string.Empty);

            using (frmMain main = new frmMain(newContent))
            {
                DialogResult result = main.ShowDialog();
                if (result == DialogResult.OK)
                {
                    newContent = main.getText;
                }
                return result;
            }
        }
    }
}
